package org.rcloud.io.controller;

import com.alibaba.fastjson.JSONObject;
import org.rcloud.io.Utils.ResultVo;
import org.rcloud.io.model.ShootLike;
import org.rcloud.io.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RequestMapping(value = "/like")
@RestController
public class LikeController {


    @Autowired
    private LikeService likeService;

    @RequestMapping(value = "/addlike")
    @ResponseBody
    @CrossOrigin
    public ResultVo addLike(@RequestBody String params) {
        ShootLike shootLike = JSONObject.parseObject(params, ShootLike.class);
        shootLike.setTime(new Date());
        return likeService.addLike(shootLike);
    }

}
